home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / FPAv223.lha / FPAV / FPAV.rexx next >
OS/2 REXX Batch file  |  1995-02-23  |  14KB  |  136 lines

  1. /*    FPAV by: Peter 'PMK' Klein.  Flux Point Amiga BBS +45 3526 2527    */
  2.  
  3. local=1        /* Mod Playing/Pic Viewing in local mode?   0=Disable 1=Enable    */
  4. rmo=0        /* Allow remote Sysop to use the Add to archives?  0=No 1=Yes    */
  5. fmem=300    /* How much MEM should ALWAYS be available to the system? (Kb)    */
  6. maxsz=2000    /* How much of a text may a 'lamer' see, before break? (bytes)  */
  7. lamers=' 0 1 2 3 4 5 10 18 ' /* Access groups that may only see <maxsz> text*/
  8. dag=' 6 19 20 30 '            /* Access groups that may Download from archives*/
  9. stp='StripAdd.List'            /* Name of BBS-Ad StripList         */
  10. spl='PlaySound'                /* IFF Sound player.                */
  11. avi='PPShow NOFLICKER'        /* IFF Anim player.                    */
  12. ivi='PPShow NOFLICKER'        /* IFF Pic viewer.                    */
  13. gvi='PPShow NOFLICKER'        /* GIF Pic viewer.                    */
  14. pvi='VT'                    /* PCX Pic viewer.                    */
  15. jvi='PPShow NOFLICKER'        /* JPEG Pic viewer.                    */
  16. mvi='mpeg_play'                /* MPEG Anim viewer.                */
  17. ovi='ShowObj'                /* Imagine/LightWave object viewer.    */
  18. guv='MultiView'                /* Local AmigaGuide viewer.            */
  19. icv='FastIcon'                /* Icon Viewer.                        */
  20. led='Ed -STICKY'            /* Local Editor.                    */
  21. tvi=''                        /* Optional Text viewer.            */
  22. gvr='MoreText'                /* Remote AmigaGuide viewer.        */
  23. deli='DH1:DeliTracker_II/DeliTracker2'    /* Delitracker            */
  24.  
  25. options results;signal on syntax;signal on ioerr;se=sendstring;gu=getuser;tr=transmit;gc=getchar;pr=prompt;ver="$VER: FPAV 2.23 (21.02.95) by PMK"
  26. if ~show('l','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit
  27. Call pragma(P,-2);gu 23;po=result;a=getclip('FP'||po);x=setclip('FP'||po,0);if a~='YEP' then do;tr "b1n1c1NOTE: q1Can't find "arg(1)"!!";exit;end
  28. if arg()=2 then ar=arg(2)'/';else ar='';fn=ar||getclip('FPFN'||po);ar=left(fn,max(lastpos('/',fn),lastpos(':',fn)));fn=substr(fn,length(ar)+1)
  29. ex=upper(right(fn,4));gu 47;tlo=result=-1;lo=tlo*local;select
  30. when ex='.ZIP' then do;alst='unzip -vUq ';aext='unzip -Uq ';aadd='zip -r ';adel='zip -dq ';aprs="parse var j sz.la +7 +9 gy.la +29 +2 crc +8 +3 na.la;gy.la=insert(' ',gy.la,9)':00'";end
  31. when ex='.LZX' then do;alst='lzx l ';aext='lzx x ';aadd='lzx -a -x a ';adel='lzx d ';aprs="parse var j +1 sz.la +7 +2 gy.la +32 +1 na.la;gy.la=insert(' ',gy.la,24)";end
  32. when ex='.LHA'|ex='.LZH'|ex='.RUN' then do;alst='lha -b64 -m -Qw -Qo v ';aext='lha -I -b64 -m -Qw -Qo x ';aadd='lha -I -b64 -m -Qw -Qo -x u ';adel='lha -I -b64 -m -Qw -Qo d ';aprs="parse var j +1 sz.la +7 +1 gy.la +32 +2 na.la;gy.la=insert(' ',gy.la,24)";end
  33. otherwise do;if ex='.GIF' then do;call UPIC(gvi);exit;end;if lo&ex='.MPG' then do;call UPIC(mvi);exit;end
  34. if ex='.IFF' then do;call UPIC(ivi);exit;end;if ex='.JPG' then do;call UPIC(jvi);exit;end
  35. if ex='.ANI' then do;call UPIC(avi);exit;end;if ex='.PCX' then do;call UPIC(pvi);exit;end
  36. tr 'n1Sorry - viewing of 'ex' is not supported!';exit;end;end
  37. parse var ver 7 p!' 'v!' ' +11 m!;dlp='';li=' ---- -------- ------ ----- ---------  --------  ------------------'
  38. gu 41;sop=SUBOP(result);gu 1100468;ll=result;gu 17;sy=(result~=0);gu 15;ag=' 'result' '
  39. ifil='ram:FPAV'po'.ID';wfil='ram:FPAV'po'.LST';wdir='ram:FPAV'po
  40. call pragma('D',ar);cdir=pragma('D');if right(cdir,1)~=':' then cdir=cdir'/';call makedir(wdir);call pragma('D',wdir);call INIT;mor=BBSLINE(1064)' '
  41. do until gk='NO';la=1;d=7;ud=0;q=0;tr '@6c5n1'p!' v'v!' 'm!' - Flux Point Amiga BBS  +45 3526 2527n2c7Listing of archive: c3'fn'n2c7   #  Original Packed Ratio    Date      Time    Namen1'li
  42. do while ~ud&la~=hi;if re&la>ti then do;j=readln(fp);interpret(aprs);if substr(sz.la,2,3)='---'|EOF(fp) then do;hi=la;re=0;ud=1;end
  43. if na.la=''|(substr(gy.la,13,1)~='%'&ex~='.LZX')|crc='00000000' then iterate;end;tr '@6'right(la,4)') c2'sz.la gy.la' c7 'translate(substr(' 'na.la,1+lastpos('/',substr(' 'na.la,2))),'+','/')
  44. la=la+1;d=d+1;if ll=d then do;se '@6'mor;gc;ke=CHECK(result);tr '^1';if ke='N' then ud=1;if ke~='C' then d=1;end;end
  45. ti=la-1;query '@61'li'n2c7Item number(s) to VIEW [c2Nonec7]: ';it=CHECK(result);if it='' then do;gk='NO';iterate;end
  46. pn=0;au=PARSE(it,1,ti);do vn=1 to au while ~pn;call ACTION(it.vn);end;dlp='';pr 1 noyes 'n1View archive "c3'fn'c7" again [c2Noc7]? ';gk=CHECK(result);end
  47. call close(fp);call pragma('D','RAM:');call pragma('D','RAM:');call delete(wfil);call delete(ifil);address command 'delete 'wdir' ALL QUIET'
  48. if right(so1,1)='01'x&substr(so1,61,1)~='01'x then call delete(cdir||fn);exit
  49. ACTION:;arg nr;dfil=na.nr;select;when mo=6 then do;call CRCAD;call INIT;end;when mo=5&led~='' then do;if UNPACK() then return;call EDFIL;call delete(dpat);call INIT;end
  50. when mo=4 then do;call BBSAD;call INIT;end;when mo=3&adel~='' then do;call DELFIL;call INIT;end;when mo=2&aadd~='' then do;call ADDFIL;call INIT;end
  51. when mo=1 then do;if UNPACK() then return;call DLOAD;call delete(dpat);end;otherwise do;if UNPACK() then return;call IDENT
  52. if vn~=au&~q then do;se 'n2c7Press [c2Qc7] to quit or [c2RETURNc7] to continue.';gc;if CHECK(result)='Q' then pn=1;tr 'n1';end;call delete(dpat);end;end;return
  53. DLOAD:;if ~q then do;pr 1 noyes 'n1Download c3'dfil'c7 [c2Noc7]? ';ke=CHECK(result);if ke='NO' then return;end
  54. if tlo then do;if dlp='' then do;pr 40 normal 'n1Copy to path: ';dlp=CHECK(result);if dlp='' then return;end
  55. tr 'n1Copying c3'dfil'c7 to c3'dlp'c7';address command 'copy "'dpat'" TO "'dlp'"';end;else XDN dpat;return
  56. EDFIL:if ~q then do;pr 1 yesno 'n1c7Edit "c3'dfil'c7" [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  57. se 'n1Editing c3'dfil'c7, one moment....';address command led' "'dfil'"';tr 'Done!'
  58. if ~q then do;pr 1 yesno 'n1c7Save "c3'dfil'c7" to "c3'fn'c7" [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  59. address command aadd'"'cdir||fn'" "'dfil'"';return
  60. ADDFIL:;pr 50 normal 'n1c7Enter Path/file to add to archive: ';ake=CHECK(result);if ake='' then return
  61. if ~exists(ake) then do;tr 'n1Error, c3'ake'c7 not found!';signal ADDFIL;end
  62. adc=aadd;if ~q&index(ake,'/')>0 then do;pr 1 yesno 'n1c7Include full path when adding file [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then adc=delstr(adc,index(adc,' -x'),3);end
  63. se 'n1Addingc3 'ake'c7 to c3'fn'c7, one moment....';address command adc'"'cdir||fn'" "'ake'"';tr 'Done!';return
  64. DELFIL:;if ~q then do;pr 1 yesno 'n1c7Delete "c3'dfil'c7" [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  65. se 'n1Deleting c3'dfil'c7, one moment....';address command adel'"'cdir||fn'" "'dfil'"';tr 'Done!';return
  66. UNPACK:;if sz.nr>storage()-fmem*1024 then do;tr 'n1Sorry! - file "c3'dfil'c7" is too big to fit into memory!';return 1;end
  67. se 'n1Un-arcing "c3'dfil'c7", one moment....';address command aext'"'cdir||fn'" "'dfil'"';dpat=wdir'/'dfil
  68. if ~exists(dpat) then do;tr 'c1Error!c7 file not found!';return 1;end;tr 'Done!';return 0
  69. IDENT:;pp=1;xp=1;IDENT2:;address command 'WhatIs >'ifil' "'dpat'"';call open(pf,ifil,'R')
  70. id=strip(strip(substr(readln(pf),36),'B',''),'B','');call close(pf)
  71. if pp&((index(id,'PP ')>0&index(id,'Pass')=0)|(index(id,'Pow')>0&index(id,'/E')=0)) then do
  72. se 'n1Powerpacked file, additional decrunching....';address command 'dld >NIL: "'dpat'"';tr 'Done!';pp=0;signal IDENT2;end
  73. if xp&index(id,'Xpk ')>0&index(id,'cry')=0 then do;se 'n1Xpk-packed file, additional decrunching....';address command 'XUP >NIL: "'dpat'"';tr 'Done!';xp=0;signal IDENT2;end
  74. select;when index(id,'Lhar')>0|index(id,'Zip')>0 then signal NEW
  75. when index(id,'n exe')>0|index(id,'n li')>0|index(id,'ce dr')>0 then call VRS
  76. when lo&upper(right(dpat,4))='.ICN' then call RIP
  77. when index(id,'wn dat')>0 then call TXT
  78. when index(id,'Gui')>0 then do;if lo&guv~='' then address command guv' FILE "'dpat'" PUBSCREEN CNETSCREEN'po;else se '#4'gvr' FILE 'dpat' LINES 'll'}f1';end
  79. when lo&index(id,'ve 3')>0|lo&index(id,'Imagine')>0 then call PIC(ovi' PUBSCREEN CNETSCREEN'po)
  80. when lo&index(id,'module')>0&index(id,'TFM')=0&index(id,'pile')=0 then call MOD
  81. when lo&index(id,'MPeg')>0 then call PIC(mvi);when index(id,'PEG')>0 then call PIC(jvi)
  82. when lo&index(id,'ico')>0 then call PIC(icv);when lo&index(id,'d sam')>0 then call SND
  83. when index(id,'IFF p')>0 then call PIC(ivi);;when index(id,'on/a')>0 then call PIC(avi)
  84. when index(id,'PCX')>0 then call PIC(pvi);when index(id,'GIF')>0 then call PIC(gvi)
  85. otherwise tr 'n1c7File Identification for 'dfil': c2'id'c7n1';end;return
  86. NEW:;x=setclip('FP'po,'YEP');x=setclip('FPFN'po,dfil);spawn 'PFiles:FPAV/FPAV.rexx' 1 wdir;exit
  87. VRS:;tr 'n2Version Info for c3'dfil':c7  ('id')';address command 'version FILE >'ifil' "'dpat'" FULL'
  88. if RC=0 then sendfile ifil;else tr 'n1c7Sorry, this file has no Version string! (Bad Coding!!)';return
  89. RIP:;if ~q then do;pr 1 yesno 'n1"c3'dfil'c7" is a RIP-icon, view it [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  90. se '#4ICNview "'dpat'"}';return
  91. PIC:;se '#4GFXList "'dpat'"}';if ~lo then return
  92. if ~q then do;pr 1 yesno 'n1"c3'dfil'c7" is a 'id', view it [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  93. address command arg(1)' "'dpat'"';return
  94. SND:;if ~q then do;pr 1 yesno 'n1"c3'dfil'c7" is an 'id', play it [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  95. address command spl' "'dpat'"';return
  96. MOD:;if ~q then do;pr 1 yesno 'n1"c3'dfil'c7" is a 'id', play it [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  97. if ~show('P','DELITRACKER') then do;address command 'RUN >NIL: 'deli' CONFIG S:DELITRACKER.CONFIG CX_POPUP NO PUBSCREEN CNETSCREEN'po
  98. do 1 while ~show('P','DELITRACKER');address command 'waitforport DELITRACKER';end;if RC=5 then do;tr 'n1b1Sorry - unable to load Delitracker!';return;end;end
  99. address 'DELITRACKER';'PUBSCREEN CNETSCREEN'po;'SHOWGUI';'PLAYMOD 'dpat;'STATUS m pnr';address
  100. if result>0 then do;a=0;do a=a+1 until result=dfil|a>100;address 'DELITRACKER' 'STATUS m fil';end;end
  101. else tr 'n1Sorry - No player loaded for Moduletype: c3'word(id,1)'c7';return
  102. TXT:;call open(pf,dpat,'R');a=readch(pf,maxsz);call close(pf);pc=length(compress(a,xrange('00'x,'08'x)xrange('0E'x,'1F'x)xrange('7F'x,'FF'x)'0B0C'x))*100%length(a)
  103. if ~q&pc<98 then do;pr 1 noyes 'n1This file is only c3'pc'%c7 ASCII, Type it anyway [c2Noc7]? ';ke=CHECK(result);if ke='NO' then return;end
  104. if index(lamers,ag)>0 then do;call open(pf,dpat,'W');call writeln(pf,a' [BREAK]'||'0a0a'x||'      ******  Download the archive, if you want to read more!!  ******'||'0a'x)
  105. call close(pf);end;if tvi='' then se 'q1f1*3'dpat'}';else se '#4'tvi' FILE 'dpat' LINES 'll'}f1';return
  106. CRCAD:;if ~q then do;pr 1 yesno 'n1Add the name "c3'dfil'c7" to ENV:'stp' [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  107. address command 'lha -b64 -m -Qw -Qo vv >'ifil' "'cdir||fn'" "'dfil'"' 
  108. call open(pf,ifil,'R');do 8;z=readln(pf);end;call close(pf);parse var z usz csz . . . . . crc .
  109. query 'Name: 'dfil' Unpacked: 'usz' Packed: 'csz' CRC: 'crc;return
  110. BBSAD:;if ~q then do;pr 1 yesno 'n1Add the name "c3'dfil'c7" to ENV:'stp' [c2Yesc7]? ';ke=CHECK(result);if ke='NO' then return;end
  111. tfil=translate(dfil,'?????????',' %|#*[]()');if tfil~=dfil&~q then do;pr 1 yesno 'n1Translate illegal chars in the name "c3'dfil'c7" [c2Yesc7]? '
  112. ke=CHECK(result);if ke='YES' then dfil=tfil;end;else dfil=tfil;se 'n1Adding c3'dfil'c7 to ENV:'stp', one moment....'
  113. call open('fa','ENV:'stp,'A');call writeln('fa',dfil);call close('fa');address command 'Copy ENV:'stp' to ENVARC:';tr 'Done!';return
  114. UPIC:;se '#4GFXList "'ar||fn'"}';if lo then address command arg(1)' "'ar||fn'"';return
  115. INIT:;hi=0;ti=0;re=1;ud=0;la=1;call close(fp);address command alst'>'wfil' "'cdir||fn'"'
  116. call open(fp,wfil,'R');do until substr(la,2,3)='---'|EOF(fp);la=readln(fp);end;la=1;return
  117. PARSE:;arg it,min,max;mo=upper(left(it,1));select;when mo='?' then do;mo=0;it=0;call HELP;end;when mo='D'&(sop|sy|index(dag,ag)>0) then do;mo=1;call QUICK;end
  118. when mo='A'&(sy|sop)&(rmo|tlo) then do;mo=2;it=1;end;when mo='K'&(sy|sop) then do;mo=3;call QUICK;end;when mo='B'&(sy|sop)&(rmo|tlo) then do;mo=4;call QUICK;end
  119. when mo='E'&tlo then do;mo=5;call QUICK;end;when mo='C'&(sy|sop)&(rmo|tlo)&(ex='.LHA'|ex='.LZH') then do;mo=6;call QUICK;end;otherwise do;mo=0;call QUICK2;end;end
  120. it.='';c=0;it=translate(it,'  ','.,');do a=1 to words(it);c=c+1;it.c=word(it,a)
  121. if index(it.c,'-')>0 then do;parse var it.c x'-'y;if y='' then y=max;if x='' then x=min;if x>y then do;d=x;x=y;y=d;end
  122. if x<min|y>max|~datatype(x,'W')|~datatype(y,'W') then do;c=c-1;iterate;end;do b=x to y;it.c=b;c=c+1;end;c=c-1;end
  123. else if it.c<min|it.c>max|~datatype(it.c,'W') then do;c=c-1;iterate;end;end;return c
  124. QUICK:;it=substr(it,2);QUICK2:;if right(it,1)='!' then do;q=1;it=left(it,length(it)-1);end;return
  125. HELP:;tr 'f1c5n1>8'substr(ver,7)' - Flux Point Amiga BBS  +45 3526 2527n2c3 FPAV is a program to display textfiles or fileinfo on files within archives.'
  126. tr ' Input must be in the following format:n2     c2#c7   any item number>nExample: c65n2   c2#-#c7   a RANGE of values>lExample: c66-11c7'
  127. tr 'n1 c2, or .c7  to separate multiple RANGES>bExample: c64,7,9-11n2c3    Additional commands/options:c7'
  128. if sop|sy|index(dag,ag)>0 then tr 'n1  [c2Dc7]ownload file(s) from archive.>dExample: c6D2,4-5c7'
  129. if (sop|sy)&(rmo|tlo) then tr 'n1  [c2Ac7]dd file to archive.>nExample: c6Ac7n2  [c2Bc7]BS-Ad to c1ENV:'left(stp'c7 adding!.',32)'Example: c6B4-5c7'
  130. if tlo then tr'n1  [c2Ec7]dit textfile(s) inside archive.           Example: c6E2,5c7'
  131. if (sy|sop) then tr 'n1  [c2Kc7]ill file(s) inside archive.>fExample: c6K4-5c7';tr 'n1c3 If the input range ends in a "c7!c3" (Quick-mode), then FPAV will skip prompts!c7';return
  132. SUBOP:;id1=x2c(d2x(arg(1),8));gu 1209388;su1=result*488+96;gu 2401068;so1=import(x2c(d2x(result+su1,8)),210);sup=0;do a=0 to 5;if id1=substr(so1,a*4+1,4) then sup=1;end;return sup
  133. BBSLINE: procedure;arg li;getuser 1402022;ln=import(import(offset(x2c(d2x(result,8)),(li-1)*4),4),256);parse var ln ln'00'x .;return ln
  134. CHECK:;arg ch;if ch~='###PANIC' then return ch;logentry 'Lost Carrier in FPAV!';bufferflush;exit
  135. IOERR:;SYNTAX:;er='Error in line: 'sigl' Code: 'errortext(rc);tr er;logentry er;bufferflush;exit
  136.